package com.lxw.manage_cms.config;


import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.gridfs.GridFSBucket;
import com.mongodb.client.gridfs.GridFSBuckets;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.gridfs.GridFsTemplate;
import org.springframework.web.client.RestTemplate;

@Configuration
public class CmsConfiguration {

    public static final String EXCHANGE_NAME = "ex_routing_cms_postpage";

    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    @Bean
    public GridFSBucket getGridFSBucket(MongoClient mongoClient){
        MongoDatabase database = mongoClient.getDatabase("edu");
        GridFSBucket bucket = GridFSBuckets.create(database);
        return bucket;
    }
}
